from rest_framework import serializers

from social.rank.models import Rank
from social.user.serializers import SimpleUserSerializer


class RankSerializer(serializers.ModelSerializer):
    user = serializers.SerializerMethodField()

    def get_user(self, instance):
        return SimpleUserSerializer(instance.user).data

    class Meta:
        model = Rank
        fields = ('coin', 'user')
